#ifndef CLIENTCONTEXTEXT_H
#define CLIENTCONTEXTEXT_H

#include <WinSock2.h>
#include <Windows.h>
#include "Log.h"

class ITransHandler;

class ClientContextExt
{
public:
	ClientContextExt();

	~ClientContextExt();

	ITransHandler* SrcHandler()
	{
		return m_srcHandler;
	}

	ITransHandler* SetSrcHandler(ITransHandler *handler)
	{
		ITransHandler *temp=m_srcHandler;
		m_srcHandler=handler;
		return temp;
	}

	ITransHandler* DestHandler()
	{
		return m_destHandler;
	}

	ITransHandler* SetDestHandler(ITransHandler *handler)
	{
		ITransHandler *temp=m_destHandler;
		m_destHandler=handler;
		return temp;
	}

	WSABUF* Buffer2()
	{
		return m_buffer2;
	}

	OVERLAPPED* OVL2()
	{
		return m_ovl2;
	}

	WSABUF* WeakRefBuffer2()
	{
		return m_weakRefBuf2;
	}

	void Initalize();
private:
	static log4cplus::Logger log;

	void InitAsyncParam(OVERLAPPED**,WSABUF**);

	ITransHandler *m_srcHandler;

	ITransHandler *m_destHandler;

	OVERLAPPED *m_ovl2;

	WSABUF *m_buffer2;

	WSABUF *m_weakRefBuf2;
};

#endif